<template>
	<view class="mainpadding beijingse">
		<view class="shangbj ffffff radius mainpadding" v-for="item in list.data" :key="item.id">
			<view class="flexleft">
				<image class="touxiang margin_right2" :src="item.avatar_text" mode=""></image>
				<view class="">
					<view class="ershiba fonweight">{{item.nickname}}</view>
					<view class="smalltext xiaohui margin_top1">手机号：{{item.mobile}}</view>
					<view class="smalltext xiaohui margin_top1">{{item.rec_time_text}}</view>
				</view>
			</view>
			<view class="margin_top2 huibox">
				<view class="ershil zhonghei">累计业绩：
					<text class="ershil xiaocheng">￥{{item.ljyj_total_price}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad() {
			if (httpRequest.checkIsLogin()) {
				this.init()
			}
		},
		methods: {
			init(isPage, page) {
				let _this = this
				httpRequest.request('/api/user/teamList', 'GET', {
					page: page || 1,
					limit: _this.limit,
				}).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.huibox {
		padding: 20rpx 30rpx;
		background: #F1F1F1;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
	}

	.touxiang {
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
	}

	.shangbj {
		margin-top: 30rpx;
	}

	.shangbj:first-child {
		margin-top: 0rpx;
	}
</style>